package com.ruoyi.system.tools;

public class BooleanMessage {

	public static int STATE_ERROR = 0;
	public static int STATE_SUCCESS = 1;
	public static int STATE_WARN = 2;
	
	/*
	 * 0 = ERROR
	 * 1 = SUCCESS
	 * 2 = WARN
	 */
	private int state;
	
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}

	
	private boolean ok = false;
	private Object message;
	public boolean isOk() {
		return ok;
	}
	public void setOk(boolean ok) {
		this.ok = ok;
	}
	public Object getMessage() {
		return message;
	}
	public void setMessage(Object message) {
		this.message = message;
	}
	
	public static BooleanMessage getSuccessMessage(Object message){
		BooleanMessage booleanMessage = new BooleanMessage();
		booleanMessage.setOk(true);
		booleanMessage.setState(STATE_SUCCESS);
		booleanMessage.setMessage(message);
		return booleanMessage;
	}
	
	public static BooleanMessage getErrorMessage(String message){
		BooleanMessage booleanMessage = new BooleanMessage();
		booleanMessage.setOk(false);
		booleanMessage.setState(STATE_ERROR);
		booleanMessage.setMessage(message);
		return booleanMessage;
	}
	
	public static BooleanMessage getWarnMessage(String message){
		BooleanMessage booleanMessage = new BooleanMessage();
		booleanMessage.setOk(false);
		booleanMessage.setState(STATE_WARN);
		booleanMessage.setMessage(message);
		return booleanMessage;
	}

}
